home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / aplictns / plplot26 / part03 < prev    next >
Encoding:
Internet Message Format  |  1990-01-14  |  57.8 KB

  1. Path: xanth!cs.odu.edu!Amiga-Request
  2. From: Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v90i004: plplot 2.6 - C library for making scientific plots, Part03/12
  5. Message-ID: <10976@xanth.cs.odu.edu>
  6. Date: 14 Jan 90 23:13:11 GMT
  7. Sender: tadguy@cs.odu.edu
  8. Reply-To: Anthony M. Richardson <amr@dukee.egr.duke.edu>
  9. Lines: 2030
  10. Approved: tadguy@cs.odu.edu (Tad Guy)
  11.  
  12. Submitted-by: Anthony M. Richardson <amr@dukee.egr.duke.edu>
  13. Posting-number: Volume 90, Issue 004
  14. Archive-name: applications/plplot-2.6/part03
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then unpack
  18. # it by saving it into a file and typing "sh file".  To overwrite existing
  19. # files, type "sh file -c".  You can also feed this as standard input via
  20. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  21. # will see the following message at the end:
  22. #        "End of archive 3 (of 12)."
  23. # Contents:  drivers/README drivers/preferences.c examples/example01.c
  24. #   include/dispatch.h include/plamiga.h lattice/Makefile.inc
  25. #   lattice/make-all src/pldeco.c src/plenv.c src/plfontld.c
  26. #   src/plgrid3.c src/plt3zz.c src/plw3d.c unix/Makefile unix/hp7470.c
  27. #   unix/hp7580.c unix/xterm.c
  28. # Wrapped by tadguy@xanth on Sun Jan 14 18:11:29 1990
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f 'drivers/README' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'drivers/README'\"
  32. else
  33. echo shar: Extracting \"'drivers/README'\" \(3273 characters\)
  34. sed "s/^X//" >'drivers/README' <<'END_OF_FILE'
  35. XMaking a new driver is pretty easy.  If you can write a C program that
  36. Xcan draw a line on the given device, you can probably write a plplot
  37. Xdriver for it.
  38. X
  39. XOverview
  40. XThe best way to create a new driver is to start with one of the old ones.
  41. XAt the minimum you will need to supply routines to (1) open/initialize the
  42. Xdevice, (2) draw a line between two points on the device, and (3) close
  43. Xthe device.  These three routines are discussed further below.
  44. XAfter writing the routines you will need to update the dispatch table
  45. X(dispatch.c) in the drivers directory.
  46. X
  47. XThe initialization routine.
  48. X   This routine is of type void and takes no arguments. This routine
  49. X   sets up the resolution and page size for plplot. It accomplishes this
  50. X   by calling the following routines:
  51. X
  52. X   (1) setpxl(float x, float y)  
  53. X       Set the resolution in dots per mm in the x and y directions.
  54. X       example -- setpxl(40.,40.)    40 dots/mm or 1016 dpi
  55. X
  56. X   (2) setphy(int minx, int maxx, int miny, int maxy)
  57. X       Set the min and max page coordinates for the device.  The values
  58. X       passed to your line drawing routine will be within this range.
  59. X       example -- setphy(0,10299,0,7649)
  60. X
  61. X   (3) scol(int color) 
  62. X       Set default pen color.
  63. X       example -- scol(1)
  64. X       
  65. X   (4) swid(int width)
  66. X       Set default pen width.
  67. X       example -- swid(1)
  68. X
  69. X   (5) smod(int mode)
  70. X       Set/clear interactive device flag. If mode == 1 device is interactive
  71. X       i.e. a terminal (plplot will wait for user input before clearing
  72. X       the screen). If mode == 0 device is not interactive.
  73. X       example -- smod(0) 
  74. X
  75. X    Portrait/landscape mode of plotting is set by the driver.  See the
  76. X    supplied drivers for one method of doing this.  If you are writing
  77. X    a new dirver you might want to ignore this for now (add it in later).
  78. X
  79. XThe line drawing routine
  80. X    This should be of type void. It should draw a line between two points
  81. X    It takes the following integer arguments
  82. X       x1 - x coord of first point
  83. X       y1 - y coord of first point
  84. X       x2 - x coord of second point
  85. X       y2 - y coord of second point
  86. X    These will all be within the range specified by setphy() in the
  87. X    initialization routine.
  88. X
  89. XThe close/tidy routine
  90. X    This is of type void. It takes no arguments.  Use it to cleanup
  91. X    and recover any allocated resources.
  92. X
  93. X
  94. XUpdating the dispatch table
  95. X    You'll need to update the dispatch table in dispatch.c.
  96. X    Add the function declarations for your 3 driver routines to the
  97. X    others near the top of the file. Update the dispatch table.
  98. X    The first entry is a character string that is printed out in
  99. X    the device selection menu.  The 4th entry should be the name
  100. X    of your initialization routine. The 5th your line routine and the
  101. X    8th your close/tidy routine.  All the others can be set to NULL
  102. X    (You'll probably want to add these later).
  103. X
  104. X
  105. XNote: I've noticed that the pattern fill routines mess up on low
  106. Xresolution devices. I got around this by faking plplot into thinking
  107. Xthat the device has high resolution by using setpxl() and setphy()
  108. Xto make a high resolution virtual page.  I then scale down the values
  109. XI receive in the line drawing routine before passing them on to the
  110. Xdevice. An example of this is in the iff driver.
  111. X
  112. XTony
  113. Xresolution 
  114. END_OF_FILE
  115. if test 3273 -ne `wc -c <'drivers/README'`; then
  116.     echo shar: \"'drivers/README'\" unpacked with wrong size!
  117. fi
  118. # end of 'drivers/README'
  119. fi
  120. if test -f 'drivers/preferences.c' -a "${1}" != "-c" ; then 
  121.   echo shar: Will not clobber existing file \"'drivers/preferences.c'\"
  122. else
  123. echo shar: Extracting \"'drivers/preferences.c'\" \(3175 characters\)
  124. sed "s/^X//" >'drivers/preferences.c' <<'END_OF_FILE'
  125. X#include "plplot.h"
  126. X#include <stdio.h>
  127. X
  128. Xstatic int orient, select=0, curwid;
  129. Xstatic long bmapx, bmapy, bmapxmax, bmapymax, xdpi, ydpi;
  130. Xstatic long dwidth, dheight;
  131. X
  132. Xvoid prefsetup(xddpi, yddpi, xwid, ywid)
  133. XPLINT xwid, ywid;
  134. XPLFLT xddpi, yddpi;
  135. X{
  136. X   /* Ignore these and use preferences data instead. */
  137. X}
  138. X
  139. Xvoid prefselect(ori, name)
  140. XPLINT ori;
  141. Xchar *name;
  142. X{
  143. X   orient = ori;
  144. X   select = 1;
  145. X}
  146. X
  147. X/* Most of the code is in plsupport.c  where it is shared with the menu
  148. X   selection printer dump. */
  149. Xvoid prefinit()
  150. X{
  151. X   char line[10];
  152. X   int mode, openprinter(), mapinit(), queryprint();
  153. X   void closeprinter();
  154. X
  155. X   if(!select) {
  156. X      printf("Landscape or portrait orientation? (0 or 1) ");
  157. X      fgets(line,sizeof(line),stdin);
  158. X      if(sscanf(line,"%d",&orient) != 1)
  159. X         orient = 0;
  160. X   }
  161. X   select = 0;
  162. X
  163. X   if(openprinter()) plexit("");
  164. X
  165. X   mode = queryprint(&bmapx, &bmapy, &bmapxmax, &bmapymax, &xdpi, &ydpi);
  166. X
  167. X   /* If mode == 1 we want to adjust the bitmap size so that the aspect
  168. X      ratio is maintained. */
  169. X   if(mode) {
  170. X      if((float)bmapxmax*bmapy > (float)bmapymax*bmapx)
  171. X         bmapy = (int)(((float)bmapx*bmapymax)/bmapxmax + .5);
  172. X      else
  173. X         bmapx = (int)(((float)bmapy*bmapxmax)/bmapymax + .5);
  174. X   }
  175. X
  176. X   /* Leave a little space for pen width. */
  177. X   dwidth = bmapx - 2;
  178. X   dheight = bmapy - 2;
  179. X
  180. X   if(!orient) {
  181. X      setpxl((PLFLT)(ydpi/25.4), (PLFLT)(xdpi/25.4));
  182. X      setphy(0,bmapymax,0,bmapxmax);
  183. X   }
  184. X   else {
  185. X      setpxl((PLFLT)(xdpi/25.4), (PLFLT)(ydpi/25.4));
  186. X      setphy(0,bmapxmax,0,bmapymax);
  187. X   }
  188. X
  189. X   scol(1);
  190. X   swid(1);
  191. X   smod(0);
  192. X
  193. X   /* Allocate bitmap and initial for line drawing */
  194. X   if(mapinit(bmapx, bmapy)) {
  195. X      closeprinter();
  196. X      plexit("");
  197. X   }
  198. X}
  199. X
  200. Xvoid preftext()
  201. X{
  202. X}
  203. X
  204. Xvoid prefgraph()
  205. X{
  206. X}
  207. X
  208. Xvoid prefclear()
  209. X{
  210. X   void ejectpage(), dmpport();
  211. X
  212. X   dmpport(0L,bmapx,bmapy);
  213. X   /* Eject the page. */
  214. X   ejectpage();
  215. X}
  216. X
  217. Xvoid prefpage()
  218. X{
  219. X   void mapclear();
  220. X
  221. X   mapclear();
  222. X}
  223. X
  224. Xvoid prefwidth(width)
  225. XPLINT width;
  226. X{
  227. X   if(width < 1)
  228. X      curwid = 1;
  229. X   else if(width > 3)
  230. X      curwid = 3;
  231. X   else
  232. X      curwid = width;
  233. X}
  234. X
  235. Xvoid prefcolor(color)
  236. XPLINT color;
  237. X{
  238. X}
  239. X
  240. Xvoid prefline(x1,y1,x2,y2)
  241. XPLINT x1, y1, x2, y2;
  242. X{
  243. X   long xn1, yn1, xn2, yn2;
  244. X   void mapline();
  245. X
  246. X   if(!orient) {
  247. X      xn1 = (x1*dheight)/bmapymax;
  248. X      yn1 = (y1*dwidth)/bmapxmax;
  249. X      xn2 = (x2*dheight)/bmapymax;
  250. X      yn2 = (y2*dwidth)/bmapxmax;
  251. X      switch(curwid) {
  252. X         case 3:
  253. X            mapline(yn1,xn1,yn2,xn2);
  254. X         case 2:
  255. X            mapline(yn1+2,xn1+2,yn2+2,xn2+2);
  256. X         case 1:
  257. X         default:
  258. X            mapline(yn1+1,xn1+1,yn2+1,xn2+1);
  259. X      }
  260. X   }
  261. X   else {
  262. X      xn1 = (x1*dwidth)/bmapxmax;
  263. X      yn1 = (y1*dheight)/bmapymax;
  264. X      xn2 = (x2*dwidth)/bmapxmax;
  265. X      yn2 = (y2*dheight)/bmapymax;
  266. X      switch(curwid) {
  267. X         case 3:
  268. X            mapline(xn1,dheight-yn1,xn2,dheight-yn2);
  269. X         case 2:
  270. X            mapline(xn1+2,dheight-yn1+2,xn2+2,dheight-yn2+2);
  271. X         case 1:
  272. X         default:
  273. X            mapline(xn1+1,dheight-yn1+1,xn2+1,dheight-yn2+1);
  274. X      }
  275. X   }
  276. X}
  277. X
  278. Xvoid preftidy()
  279. X{
  280. X   void dmpport(), mapfree(), closeprinter();
  281. X
  282. X   dmpport(0L,bmapx,bmapy);
  283. X   mapfree();
  284. X   closeprinter();
  285. X}
  286. END_OF_FILE
  287. if test 3175 -ne `wc -c <'drivers/preferences.c'`; then
  288.     echo shar: \"'drivers/preferences.c'\" unpacked with wrong size!
  289. fi
  290. # end of 'drivers/preferences.c'
  291. fi
  292. if test -f 'examples/example01.c' -a "${1}" != "-c" ; then 
  293.   echo shar: Will not clobber existing file \"'examples/example01.c'\"
  294. else
  295. echo shar: Extracting \"'examples/example01.c'\" \(2726 characters\)
  296. sed "s/^X//" >'examples/example01.c' <<'END_OF_FILE'
  297. X/* Demonstration program for PLPLOT: */
  298. X
  299. X/* Plots three simple functions, each function occupies a separate page */
  300. X
  301. X#include "plplot.h"
  302. X#include <stdio.h>
  303. X#include <math.h>
  304. X
  305. Xstatic PLFLT xs[6] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0};
  306. Xstatic PLFLT ys[6] = {1.0, 4.0, 9.0, 16.0, 25.0, 36.0};
  307. X
  308. Xmain()
  309. X{
  310. X  /* Declare these static to reduce required stack size */
  311. X  static PLFLT x[101], y[101];
  312. X  PLINT space0 = 0, mark0 = 0, space1 = 1500, mark1 =1500;
  313. X
  314. X  PLINT i;
  315. X
  316. X  /* Ask user to specify the output device */
  317. X  plstar(1,1);
  318. X
  319. X  /* Set up the viewport and window using PLENV. The range in X is */
  320. X  /* 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are */
  321. X  /* scaled separately (just = 0), and we just draw a labelled */
  322. X  /* box (axis = 0). */
  323. X
  324. X  plenv((PLFLT)0.0,(PLFLT)6.0,(PLFLT)0.0,(PLFLT)30.0,0,0);
  325. X  plcol(2);
  326. X  pllab("(x)","(y)","#frPLPLOT Example 1 - y=x#u2");
  327. X
  328. X  /* Plot the data points */
  329. X
  330. X  plcol(3);
  331. X  plpoin(6,xs,ys,9);
  332. X
  333. X  for (i=0; i<60; i++) {
  334. X     x[i]=0.1*(i+1);
  335. X     y[i]= pow(x[i],2.);
  336. X  }
  337. X
  338. X  /* Draw the line through the data */
  339. X
  340. X  plcol(4);
  341. X  plline(60,x,y);
  342. X
  343. X  /*===============================================================*/
  344. X
  345. X  /* Set up the viewport and window using PLENV. The range in X is
  346. X     -2.0 to 10.0, and the range in Y is -0.4 to 2.0. The axes are
  347. X     scaled separately (just = 0), and we draw a box with axes
  348. X     (axis = 1). */
  349. X
  350. X  plcol(1);
  351. X  plenv((PLFLT)-2.0,(PLFLT)10.0,(PLFLT)-0.4,(PLFLT)1.2,0,1);
  352. X  plcol(2);
  353. X  pllab("(x)","sin(x)/x","#frPLPLOT Example 1 - Sinc Function");
  354. X
  355. X  /* Fill up the arrays */
  356. X
  357. X  for (i=0; i<100; i++) {
  358. X     x[i] = (i-19.0)/6.0;
  359. X     y[i] = 1.0;
  360. X     if (x[i] != 0.0) y[i] = sin(x[i])/x[i];
  361. X  }
  362. X
  363. X  /* Draw the line */
  364. X
  365. X  plcol(3);
  366. X  plline(100,x,y);
  367. X
  368. X  /*===============================================================*/
  369. X
  370. X  /* For the final graph we wish to override the default tick intervals,
  371. X     and so do not use PLENV */
  372. X
  373. X  pladv(0);
  374. X
  375. X  /* Use standard viewport, and define X range from 0 to 360 degrees,
  376. X     Y range from -1.2 to 1.2. */
  377. X
  378. X  plvsta();
  379. X  plwind((PLFLT)0.0,(PLFLT)360.0,(PLFLT)-1.2,(PLFLT)1.2);
  380. X
  381. X  /* Draw a box with ticks spaced 30 degrees apart in X, and 0.2 in Y. */
  382. X
  383. X  plcol(1);
  384. X  plbox("bcnst",(PLFLT)30.0,3,"bcnstv",(PLFLT)0.2,2);
  385. X
  386. X  /* Superimpose a dashed line grid, with 1.5 mm marks and spaces.
  387. X     plstyl expects a pointer!! */
  388. X
  389. X  plstyl(1,&mark1,&space1);
  390. X  plcol(2);
  391. X  plbox("g",(PLFLT)30.0,3,"g",(PLFLT)0.2,2);
  392. X  plstyl(0,&mark0,&space0);
  393. X
  394. X  plcol(3);
  395. X  pllab("Angle (degrees)","sine","#frPLPLOT Example 1 - Sine function");
  396. X
  397. X  for (i=0; i<101; i++ ) {
  398. X     x[i] = 3.6 * i;
  399. X     y[i] = sin(x[i]*3.141592654/180.0);
  400. X  }
  401. X
  402. X  plcol(4);
  403. X  plline(101,x,y);
  404. X
  405. X  /* Don't forget to call PLEND to finish off! */
  406. X
  407. X  plend();
  408. X}
  409. END_OF_FILE
  410. if test 2726 -ne `wc -c <'examples/example01.c'`; then
  411.     echo shar: \"'examples/example01.c'\" unpacked with wrong size!
  412. fi
  413. # end of 'examples/example01.c'
  414. fi
  415. if test -f 'include/dispatch.h' -a "${1}" != "-c" ; then 
  416.   echo shar: Will not clobber existing file \"'include/dispatch.h'\"
  417. else
  418. echo shar: Extracting \"'include/dispatch.h'\" \(2848 characters\)
  419. sed "s/^X//" >'include/dispatch.h' <<'END_OF_FILE'
  420. X/* Declare structure containing pointers to device dependent functions. */
  421. X
  422. X/* pl_MenuStr : Pointer to string that is printed in device menu. */
  423. X/* pl_setup   : Use this routine to set orientation, x and y  resolution
  424. X *              (dots/mm)  and x and y page widths. Some device drivers
  425. X *              may  choose to ignore any or all of these. A call to
  426. X *              this routine is optional! If a particular driver requires
  427. X *              any of these parameters and they are not set by a call to
  428. X *              pl_setup() then they should be prompted for in pl_init().
  429. X *              The user may call this routine only once and it is called
  430. X *              before plstar() or plbeg(). */
  431. X/* pl_file    : Set graphics storage file name. This routine is also
  432. X *              optional. If a device requires a file for storage, the
  433. X *              file name should be prompted for if this routine is not
  434. X *              used. This routine may be called before plstar(), plbeg(),
  435. X *              plenv(), or pladv(). This routine does NOT open the file. */
  436. X/* pl_init    : Initialize device.  This routine may also prompt the user
  437. X *              for certain device parameters or open a graphics file (see
  438. X *               note). Called only once to set things up. */
  439. X/* pl_line    : Draws a line between two points. */
  440. X/* pl_clear   : Clears screen or ejects page or closes file (see note). */
  441. X/* pl_page    : Set up for plotting on a new page. May also open a new
  442. X *              a new graphics file (see note). */
  443. X/* pl_tidy    : Tidy up. May close graphics file (see note). */
  444. X/* pl_color   : Change pen color. */
  445. X/* pl_text    : Switch device to text mode. */
  446. X/* pl_graph   : Switch device to graphics mode. */
  447. X/* pl_width   : Set graphics pen width. */
  448. X
  449. X/* NOTE: Some devices allow multi-page plots to be stored in a single *
  450. X *       graphics file, in which case the graphics file should be opened *
  451. X *       in the pl_init() routine and closed in pl_tidy(). If multi-page *
  452. X *       plots need to be stored in different files then pl_page() should *
  453. X *       open the file and pl_clear() should close it. Do NOT open files *
  454. X *       in both pl_init() and pl_page() or close files in both pl_clear() *
  455. X *       and pl_tidy() */
  456. X
  457. Xstruct dispatch_table {
  458. X   char *pl_MenuStr;
  459. X   void (*pl_setup) PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xwid, PLINT ywid));
  460. X   void (*pl_select) PLARGS((PLINT orient, char *filename));
  461. X   void (*pl_init) PLARGS((void));
  462. X   void (*pl_line) PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2));
  463. X   void (*pl_clear) PLARGS((void));
  464. X   void (*pl_page) PLARGS((void));
  465. X   void (*pl_tidy) PLARGS((void));
  466. X   void (*pl_color) PLARGS((PLINT color));
  467. X   void (*pl_text) PLARGS((void));
  468. X   void (*pl_graph) PLARGS((void));
  469. X   void (*pl_width) PLARGS((PLINT width));
  470. X};
  471. X
  472. Xtypedef struct dispatch_table  DISPATCH_TABLE;
  473. END_OF_FILE
  474. if test 2848 -ne `wc -c <'include/dispatch.h'`; then
  475.     echo shar: \"'include/dispatch.h'\" unpacked with wrong size!
  476. fi
  477. # end of 'include/dispatch.h'
  478. fi
  479. if test -f 'include/plamiga.h' -a "${1}" != "-c" ; then 
  480.   echo shar: Will not clobber existing file \"'include/plamiga.h'\"
  481. else
  482. echo shar: Extracting \"'include/plamiga.h'\" \(3003 characters\)
  483. sed "s/^X//" >'include/plamiga.h' <<'END_OF_FILE'
  484. X#include <exec/types.h>
  485. X#include <exec/ports.h>
  486. X#include <exec/memory.h>
  487. X#include <devices/printer.h>
  488. X#include <devices/prtbase.h>
  489. X#include <graphics/display.h>
  490. X#include <graphics/gfxbase.h>
  491. X#include <graphics/view.h>
  492. X#include <graphics/gfxmacros.h>
  493. X#include <intuition/intuition.h>
  494. X#include <intuition/intuitionbase.h>
  495. X#include <intuition/screens.h>
  496. X
  497. X/* Graphics data buffer file. */
  498. X#define PLOTBFFR      "t:plplot.plt"
  499. X
  500. X#ifndef PLARGS
  501. X  #ifdef LATTICE_50
  502. X     #define PLARGS(a)   a
  503. X  #else
  504. X     #define PLARGS(a)   ()
  505. X  #endif
  506. X#endif
  507. X
  508. X#ifdef LATTICE_50
  509. X   #include <proto/exec.h>
  510. X   #include <proto/graphics.h>
  511. X   #include <proto/intuition.h>
  512. X   #include <proto/dos.h>
  513. X#endif
  514. X
  515. X/* Flags for variables in PLPrefs structure. */
  516. X/* WinType defines */
  517. X#define PLCUST      01  /* Open on custom screen */
  518. X#define PLASP       02  /* Maintain initial aspect */
  519. X#define PLBUFF      04  /* Buffer plot in t:plplot.plt */
  520. X
  521. X/* ScrType defines */
  522. X#define PLLACE      01
  523. X#define PLHIRES     02
  524. X
  525. Xtypedef unsigned short USHORT;
  526. X
  527. Xstruct PLPrefs {
  528. X   USHORT   WinType;
  529. X   USHORT   ScrType;
  530. X   USHORT   WXPos, WYPos;      /* Position of Window (WorkBench) */
  531. X   USHORT   WWidth, WHeight;   /* Window width, height (WorkBench) */
  532. X   USHORT   CXPos, CYPos;      /* Position of Window (Custom) */
  533. X   USHORT   CWidth, CHeight;   /* Window width, height (Custom) */
  534. X   USHORT   Depth;             /* Screen Depth (1, 2, 3, 4) (Custom) */
  535. X   USHORT   Color[16];         /* Color RGB values (Custom Only) */
  536. X};
  537. X
  538. X/* Define graphics operation types */
  539. X#define PENU  10
  540. X#define PEND  20
  541. X#define SPEN  30
  542. X#define PWID  40
  543. X
  544. Xextern struct IntuitionBase *IntuitionBase;
  545. Xextern struct GfxBase *GfxBase;
  546. X
  547. Xextern struct Screen *PLScreen;
  548. Xextern struct Window *PLWindow;
  549. Xextern struct RastPort *PLSRPort;      /* Screen rastport */
  550. Xextern struct RastPort *PLWRPort;      /* Window rastport */
  551. Xextern struct ViewPort *PLVPort;
  552. Xextern struct ColorMap *PLCMap;
  553. X
  554. Xextern struct PLPrefs PLCurPrefs;
  555. Xextern PLINT XOffset, YOffset, PLWidth, PLHeight;
  556. Xextern PLINT InitPLWidth, InitPLHeight;
  557. X
  558. Xvoid OpenPLWind PLARGS((void));
  559. Xvoid OpenLibs PLARGS((void));
  560. Xvoid ClosePLWind PLARGS((void));
  561. Xvoid CloseLibs PLARGS((void));
  562. Xvoid GetPLDefs PLARGS((void));
  563. Xvoid SetPLDefs PLARGS((void));
  564. Xvoid setlimits PLARGS((void));
  565. Xvoid plcolreq PLARGS((void));
  566. Xvoid RestorePrefs PLARGS((void));
  567. Xvoid setpen PLARGS((PLINT color));
  568. Xvoid MakePLMenu PLARGS((void));
  569. Xvoid enablemenus PLARGS((void));
  570. Xvoid disablemenus PLARGS((void));
  571. Xvoid menuselect PLARGS((ULONG class, USHORT code));
  572. Xvoid eventwait PLARGS((void));
  573. XPLINT eventhandler PLARGS((ULONG class, USHORT code));
  574. XPLINT procmess PLARGS((void));
  575. Xvoid remakeplot PLARGS((void));
  576. Xvoid PLDraw PLARGS((PLINT x, PLINT y));
  577. Xvoid PLMove PLARGS((PLINT x, PLINT y));
  578. Xvoid prepupdate PLARGS((void));
  579. Xint getpoint PLARGS((long *com, long *x, long *y));
  580. Xvoid finiupdate PLARGS((void));
  581. X
  582. Xvoid screendump PLARGS((PLINT type));
  583. Xvoid saveiff PLARGS((void));
  584. Xvoid disablegads PLARGS((PLINT flag));
  585. Xvoid enablegads PLARGS((void));
  586. END_OF_FILE
  587. if test 3003 -ne `wc -c <'include/plamiga.h'`; then
  588.     echo shar: \"'include/plamiga.h'\" unpacked with wrong size!
  589. fi
  590. # end of 'include/plamiga.h'
  591. fi
  592. if test -f 'lattice/Makefile.inc' -a "${1}" != "-c" ; then 
  593.   echo shar: Will not clobber existing file \"'lattice/Makefile.inc'\"
  594. else
  595. echo shar: Extracting \"'lattice/Makefile.inc'\" \(2886 characters\)
  596. sed "s/^X//" >'lattice/Makefile.inc' <<'END_OF_FILE'
  597. XODIR = ram:pltemp
  598. XNLST = ram:plname.lst
  599. XCFLG = -$(LFLGS) -i/include -O -o$(ODIR)/
  600. X
  601. XSRCS  =   /src/define.c \
  602. X          /src/fcnvrt.c \
  603. X          /src/genlin.c \
  604. X          /src/global.c \
  605. X          /src/icnvrt.c \
  606. X          /src/movphy.c \
  607. X          /src/movwor.c \
  608. X          /src/pl3cut.c \
  609. X          /src/plabv.c \
  610. X          /src/pladv.c \
  611. X          /src/plbeg.c \
  612. X          /src/plbin.c \
  613. X          /src/plbox.c \
  614. X          /src/plbox3.c \
  615. X          /src/plccal.c \
  616. X          /src/plclr.c \
  617. X          /src/plcntr.c \
  618. X          /src/plcol.c \
  619. X          /src/plcont.c \
  620. X          /src/plcvec.c \
  621. X          /src/pldeco.c \
  622. X          /src/pldtik.c \
  623. X          /src/plend.c \
  624. X          /src/plenv.c \
  625. X          /src/plerrx.c \
  626. X          /src/plerry.c \
  627. X          /src/plerx1.c \
  628. X          /src/plery1.c \
  629. X          /src/plexit.c \
  630. X          /src/plfill.c \
  631. X          /src/plfont.c \
  632. X          /src/plfontld.c \
  633. X          /src/plform.c \
  634. X          /src/plgra.c \
  635. X          /src/plgrid3.c \
  636. X          /src/plgspa.c \
  637. X          /src/plhist.c \
  638. X          /src/plhrsh.c \
  639. X          /src/pljoin.c \
  640. X          /src/pllab.c \
  641. X          /src/pllclp.c \
  642. X          /src/plline.c \
  643. X          /src/pllsty.c \
  644. X          /src/plmesh.c \
  645. X          /src/plmtex.c \
  646. X          /src/plnxtv.c \
  647. X          /src/plot3d.c \
  648. X          /src/plpage.c \
  649. X          /src/plpat.c \
  650. X          /src/plpoi1.c \
  651. X          /src/plpoin.c \
  652. X          /src/plpsty.c \
  653. X          /src/plptex.c \
  654. X          /src/plr135.c \
  655. X          /src/plr45.c \
  656. X          /src/plschr.c \
  657. X          /src/plside3.c \
  658. X          /src/plsmaj.c \
  659. X          /src/plsmin.c \
  660. X          /src/plssym.c \
  661. X          /src/plstar.c \
  662. X          /src/plstik.c \
  663. X          /src/plstr.c \
  664. X          /src/plstrl.c \
  665. X          /src/plstyl.c \
  666. X          /src/plsvpa.c \
  667. X          /src/plsym.c \
  668. X          /src/plsym1.c \
  669. X          /src/plt3zz.c \
  670. X          /src/pltext.c \
  671. X          /src/plvpor.c \
  672. X          /src/plvsta.c \
  673. X          /src/plw3d.c \
  674. X          /src/plwid.c \
  675. X          /src/plwind.c \
  676. X          /src/plxtik.c \
  677. X          /src/plxybx.c \
  678. X          /src/plxytx.c \
  679. X          /src/plytik.c \
  680. X          /src/plzbx.c \
  681. X          /src/plztx.c \
  682. X          /src/setphy.c \
  683. X          /src/setpxl.c \
  684. X          /src/setsub.c \
  685. X          /src/stindex.c \
  686. X          /src/strpos.c \
  687. X          /src/stsearch.c \
  688. X          /src/xform.c
  689. X
  690. XAMGA  =   /Amiga/amiga.c \
  691. X          /Amiga/plmenu.c \
  692. X          /Amiga/plprefs.c \
  693. X          /Amiga/plsupport.c \
  694. X          /Amiga/plwindow.c
  695. X
  696. XDRVS  =   /drivers/aegis.c \
  697. X          /drivers/dispatch.c \
  698. X          /drivers/hpplot.c \
  699. X          /drivers/iff.c \
  700. X          /drivers/postscript.c \
  701. X          /drivers/preferences.c \
  702. X
  703. X$(LIB): $(SRCS) $(DRVS) $(AMGA)
  704. X    @makedir $(ODIR)
  705. X    @lc $(CFLG) $?
  706. X    @list > $(NLST) $(ODIR) lformat="~%s~%s"
  707. X    @oml $@ r @$(NLST)
  708. X    @delete $(ODIR) all quiet
  709. X    @delete $(NLST) quiet
  710. X
  711. END_OF_FILE
  712. if test 2886 -ne `wc -c <'lattice/Makefile.inc'`; then
  713.     echo shar: \"'lattice/Makefile.inc'\" unpacked with wrong size!
  714. fi
  715. # end of 'lattice/Makefile.inc'
  716. fi
  717. if test -f 'lattice/make-all' -a "${1}" != "-c" ; then 
  718.   echo shar: Will not clobber existing file \"'lattice/make-all'\"
  719. else
  720. echo shar: Extracting \"'lattice/make-all'\" \(3196 characters\)
  721. sed "s/^X//" >'lattice/make-all' <<'END_OF_FILE'
  722. X.key lib
  723. X.def lib "FFP"
  724. X
  725. X; This script makes the entire plplot library.  It should be invoked via
  726. X; "execute make-all [FFP | IEEEF | IEEED]". If FFP (the default) is
  727. X; specified then PLFLT is typedef'd to float and the fast floating point
  728. X; math routines are to be used. If IEEEF then PLFLT is still typedef'd
  729. X; to float but the IEEE math routines are to be used.  Finally if IEEED
  730. X; is specified then PLFLT is double and the IEEE math routines are to be
  731. X; used.
  732. X
  733. Xif not "<lib>" eq "FFP"
  734. X   if not "<lib>" eq "IEEEF"
  735. X      if not "<lib>" eq "IEEED"
  736. X            echo "usage: execute make-all [FFP | IEEEF | IEEED]"
  737. X            skip end
  738. X      endif
  739. X   endif
  740. Xendif
  741. X
  742. X; Make the FFP library.
  743. Xif "<lib>" eq "FFP"
  744. X   ask "Are you sure you want to (re)make the complete FFP library? (y or n)"
  745. X   if not warn
  746. X      skip end
  747. X   endif
  748. X
  749. X   if exists /pllibs/plpffp.lib
  750. X      delete /pllibs/plpffp.lib
  751. X   endif
  752. X
  753. X   cd /src
  754. X   lmk LFLG1=-ff
  755. X   list >ofiles #?.o lformat="%s"
  756. X   oml /pllibs/plpffp.lib r @ofiles
  757. X   delete ofiles
  758. X
  759. X   cd /drivers
  760. X   lmk LFLG1=-ff
  761. X   list >ofiles #?.o lformat="%s"
  762. X   oml /pllibs/plpffp.lib r @ofiles
  763. X   delete ofiles
  764. X
  765. X   cd /Amiga
  766. X   lmk LFLG1=-ff
  767. X   list >ofiles #?.o lformat="%s"
  768. X   oml /pllibs/plpffp.lib r @ofiles
  769. X   delete ofiles
  770. X
  771. X   cd /lattice
  772. Xendif
  773. X
  774. X; Create the IEEE library with "float" floating point variables.
  775. X; Unfortunately there is a bug involving prototypes and float's in Lattice 5.04.
  776. X; (The calling function promotes all float's to double's in spite of the
  777. X; prototype while the called function expects a float.) I get around this
  778. X; and still get prototyping by creating the library without prototyping in
  779. X; effect (so that the conventional C conversions occur). Prototypes can still
  780. X; be used when linking your driver to the library. This works but causes the
  781. X; library to be larger than it normally would be. (I have reported this
  782. X; bug to Lattice by the way.)
  783. Xif "<lib>" eq "IEEEF"
  784. X   ask "Are you sure you want to (re)make the complete IEEEF library? (y or n)"
  785. X   if not warn
  786. X      skip end
  787. X   endif
  788. X
  789. X   if exists /pllibs/plplcmf.lib
  790. X      delete /pllibs/plplcmf.lib
  791. X   endif
  792. X
  793. X   cd /src
  794. X   lmk LFLG1=-dNOPROTS
  795. X   list >ofiles #?.o lformat="%s"
  796. X   oml /pllibs/plplcmf.lib r @ofiles
  797. X   delete ofiles
  798. X
  799. X   cd /drivers
  800. X   lmk LFLG1=-dNOPROTS
  801. X   list >ofiles #?.o lformat="%s"
  802. X   oml /pllibs/plplcmf.lib r @ofiles
  803. X   delete ofiles
  804. X
  805. X   cd /Amiga
  806. X   lmk LFLG1=-dNOPROTS
  807. X   list >ofiles #?.o lformat="%s"
  808. X   oml /pllibs/plplcmf.lib r @ofiles
  809. X   delete ofiles
  810. X
  811. X   cd /lattice
  812. Xendif
  813. X
  814. X; Make the IEEE library with "double" floating point variables.
  815. Xif "<lib>" eq "IEEED"
  816. X   ask "Are you sure you want to (re)make the complete IEEED library? (y or n)"
  817. X   if not warn
  818. X      skip end
  819. X   endif
  820. X
  821. X   if exists /pllibs/plplcmd.lib
  822. X      delete /pllibs/plplcmd.lib
  823. X   endif
  824. X
  825. X   cd /src
  826. X   lmk LFLG1=-dPLDBL
  827. X   list >ofiles #?.o lformat="%s"
  828. X   oml /pllibs/plplcmd.lib r @ofiles
  829. X   delete ofiles
  830. X
  831. X   cd /drivers
  832. X   lmk LFLG1=-dPLDBL
  833. X   list >ofiles #?.o lformat="%s"
  834. X   oml /pllibs/plplcmd.lib r @ofiles
  835. X   delete ofiles
  836. X
  837. X   cd /Amiga
  838. X   lmk LFLG1=-dPLDBL
  839. X   list >ofiles #?.o lformat="%s"
  840. X   oml /pllibs/plplcmd.lib r @ofiles
  841. X   delete ofiles
  842. X
  843. X   cd /lattice
  844. Xendif
  845. X
  846. Xlab end
  847. END_OF_FILE
  848. if test 3196 -ne `wc -c <'lattice/make-all'`; then
  849.     echo shar: \"'lattice/make-all'\" unpacked with wrong size!
  850. fi
  851. # end of 'lattice/make-all'
  852. fi
  853. if test -f 'src/pldeco.c' -a "${1}" != "-c" ; then 
  854.   echo shar: Will not clobber existing file \"'src/pldeco.c'\"
  855. else
  856. echo shar: Extracting \"'src/pldeco.c'\" \(3037 characters\)
  857. sed "s/^X//" >'src/pldeco.c' <<'END_OF_FILE'
  858. X/* Decode a character string, and return an array of float integer symbol */
  859. X/* numbers. This routine is responsible for interpreting all escape */
  860. X/* sequences. At present the following escape sequences are defined */
  861. X/* (the letter following the # may be either upper or lower case): */
  862. X
  863. X/* #u       :      up one level (returns -1) */
  864. X/* #d       :      down one level (returns -2) */
  865. X/* #b       :      backspace (returns -3) */
  866. X/* #+       :      toggles overline mode (returns -4) */
  867. X/* #-       :      toggles underline mode (returns -5) */
  868. X/* ##       :      # */
  869. X/* #gx      :      greek letter corresponding to roman letter x */
  870. X/* #fn      :      switch to Normal font */
  871. X/* #fr      :      switch to Roman font */
  872. X/* #fi      :      switch to Italic font */
  873. X/* #fs      :      switch to Script font */
  874. X/* #(nnn)   :      Hershey symbol number nnn (any number of digits) */
  875. X
  876. X#include "plplot.h"
  877. X#include <stdio.h>
  878. X#include <ctype.h>
  879. X#ifdef PLSTDC
  880. X#include <string.h>
  881. X#else
  882. Xextern int strlen();
  883. X#endif
  884. X
  885. Xstatic char font[] = "nris";
  886. Xstatic char greek[] = "ABGDEZYHIKLMNCOPRSTUFXQWabgdezyhiklmncoprstufxqw";
  887. X#define PLMAXSTR      300
  888. Xstatic short symbol[PLMAXSTR];
  889. X
  890. Xextern short int *fntlkup;
  891. Xextern short int numberfonts, numberchars;
  892. X
  893. Xvoid pldeco(sym,length,text)
  894. XPLINT *length;
  895. Xshort int **sym;
  896. Xchar *text;
  897. X{
  898. X   PLINT ch,icol,ifont,ig,j,lentxt;
  899. X   char test;
  900. X
  901. X   /* Initialize parameters. */
  902. X   lentxt=strlen(text);
  903. X   *length=0;
  904. X   *sym = symbol;
  905. X   gatt(&ifont,&icol);
  906. X   if(ifont > numberfonts)
  907. X      ifont = 1;
  908. X
  909. X   /* Get next character; treat non-printing characters as spaces. */
  910. X   j=0;
  911. X   while(j<lentxt) {
  912. X     if(*length >= PLMAXSTR)
  913. X        return;
  914. X     test=text[j++];
  915. X     ch=test;
  916. X     if (ch<0 || ch>175)   ch = 32;
  917. X
  918. X     /* Test for escape sequence (#) */
  919. X     if (ch=='#' && (lentxt-j)>=1) {
  920. X       test=text[j++];
  921. X       if (test=='#')
  922. X         symbol[(*length)++] = *(fntlkup+(ifont-1)*numberchars+ch);
  923. X       else if (tolower(test)=='u')
  924. X         symbol[(*length)++] = -1;
  925. X       else if (tolower(test)=='d')
  926. X         symbol[(*length)++] = -2;
  927. X       else if (tolower(test)=='b')
  928. X         symbol[(*length)++] = -3;
  929. X       else if (test=='+')
  930. X         symbol[(*length)++] = -4;
  931. X       else if (test=='-')
  932. X         symbol[(*length)++] = -5;
  933. X       else if (test=='(') {
  934. X         symbol[*length] = 0;
  935. X         while ('0'<=text[j] && text[j]<='9') {
  936. X           symbol[*length] = symbol[*length]*10 + text[j] - '0';
  937. X           j++;
  938. X         }
  939. X         (*length)++;
  940. X         if (text[j]==')') j++;
  941. X       }
  942. X       else if (tolower(test)=='f') {
  943. X         test=text[j++];
  944. X         ifont = strpos(font,(char)tolower(test)) + 1;
  945. X         if (ifont==0 || ifont > numberfonts)
  946. X            ifont = 1;
  947. X       }
  948. X       else if (tolower(test)=='g') {
  949. X         test=text[j++];
  950. X         ig = strpos(greek,test) + 1;
  951. X         symbol[(*length)++] = *(fntlkup+(ifont-1)*numberchars + 127 + ig);
  952. X       }
  953. X     }
  954. X     else
  955. X       /* Decode character. */
  956. X       symbol[(*length)++] = *(fntlkup+(ifont-1)*numberchars + ch);
  957. X   }
  958. X}
  959. END_OF_FILE
  960. if test 3037 -ne `wc -c <'src/pldeco.c'`; then
  961.     echo shar: \"'src/pldeco.c'\" unpacked with wrong size!
  962. fi
  963. # end of 'src/pldeco.c'
  964. fi
  965. if test -f 'src/plenv.c' -a "${1}" != "-c" ; then 
  966.   echo shar: Will not clobber existing file \"'src/plenv.c'\"
  967. else
  968. echo shar: Extracting \"'src/plenv.c'\" \(3019 characters\)
  969. sed "s/^X//" >'src/plenv.c' <<'END_OF_FILE'
  970. X/* Simple interface for defining viewport and window. If "just"=1,  */
  971. X/* X and Y scales will be the same, otherwise they are scaled       */
  972. X/* independently. The "axis" parameter is interpreted as follows:   */
  973. X/* axis=-2 : draw no box, axis or labels                            */
  974. X/* axis=-1 : draw box only                                          */
  975. X/* axis= 0 : Draw box and label with coordinates                    */
  976. X/* axis= 1 : Also draw the coordinate axes                          */
  977. X/* axis= 2 : Draw a grid at major tick positions                    */
  978. X/* axis=10 : Logarithmic X axis, L!=r Y axis, No X=0 axis         */
  979. X/* axis=11 : Logarithmic X axis, L!=r Y axis, X=0 axis            */
  980. X/* axis=20 : L!=r X axis, Logarithmic Y axis, No Y=0 axis         */
  981. X/* axis=21 : L!=r X axis, Logarithmic Y axis, Y=0 axis            */
  982. X/* axis=30 : Logarithmic X and Y axes                               */
  983. X
  984. X#include "plplot.h"
  985. X#include <stdio.h>
  986. X#include <math.h>
  987. X
  988. Xvoid plenv(xmin,xmax,ymin,ymax,just,axis)
  989. XPLINT just,axis;
  990. XPLFLT xmin, xmax, ymin, ymax;
  991. X{
  992. X    PLINT level;
  993. X    PLFLT chrdef, chrht;
  994. X    PLFLT lb, rb, tb, bb, dx, dy;
  995. X    PLFLT xsize, ysize, xscale, yscale;
  996. X    PLFLT spxmin, spxmax, spymin, spymax;
  997. X    PLFLT vpxmin, vpxmax, vpymin, vpymax;
  998. X    PLFLT scale;
  999. X
  1000. X    glev(&level);
  1001. X    if (level < 1) plexit("Please call plstar before plenv.");
  1002. X
  1003. X    if (xmin == xmax) plexit("Invalid xmin and xmax arguments in plenv");
  1004. X    if (ymin == ymax) plexit("Invalid ymin and ymax arguments in plenv");
  1005. X    if ((just != 0) && (just != 1)) plexit("Invalid just option in plenv");
  1006. X
  1007. X
  1008. X    pladv(0);
  1009. X    if (just == 0)
  1010. X      plvsta();
  1011. X    else {
  1012. X      gchr(&chrdef,&chrht);
  1013. X      lb = 7.0 * chrht;
  1014. X      rb = 4.0 * chrht;
  1015. X      tb = 4.0 * chrht;
  1016. X      bb = 4.0 * chrht;
  1017. X      dx = abs(xmax-xmin);
  1018. X      dy = abs(ymax-ymin);
  1019. X      plgspa(&spxmin,&spxmax,&spymin,&spymax);
  1020. X      xsize = spxmax - spxmin;
  1021. X      ysize = spymax - spymin;
  1022. X      xscale = dx/(xsize - lb - rb);
  1023. X      yscale = dy/(ysize - tb - bb);
  1024. X      scale = max(xscale,yscale);
  1025. X      vpxmin = max(lb,0.5*(xsize - dx/scale));
  1026. X      vpxmax = vpxmin + (dx/scale);
  1027. X      vpymin = max(bb,0.5*(ysize - dy/scale));
  1028. X      vpymax = vpymin + (dy/scale);
  1029. X      plsvpa(vpxmin,vpxmax,vpymin,vpymax);
  1030. X    }
  1031. X    plwind(xmin,xmax,ymin,ymax);
  1032. X    if (axis == -2)
  1033. X       ;
  1034. X    else if (axis == -1)
  1035. X       plbox("bc",0.0,0,"bc",0.0,0);
  1036. X    else if (axis == 0)
  1037. X       plbox("bcnst",0.0,0,"bcnstv",0.0,0);
  1038. X    else if (axis == 1)
  1039. X       plbox("abcnst",0.0,0,"abcnstv",0.0,0);
  1040. X    else if (axis == 2)
  1041. X       plbox("abcgnst",0.0,0,"abcgnstv",0.0,0);
  1042. X    else if (axis == 10)
  1043. X       plbox("bclnst",0.0,0,"bcnstv",0.0,0);
  1044. X    else if (axis == 11)
  1045. X       plbox("bclnst",0.0,0,"abcnstv",0.0,0);
  1046. X    else if (axis == 20)
  1047. X       plbox("bcnst",0.0,0,"bclnstv",0.0,0);
  1048. X    else if (axis == 21)
  1049. X       plbox("bcnst",0.0,0,"abclnstv",0.0,0);
  1050. X    else if (axis == 30)
  1051. X       plbox("bclnst",0.0,0,"bclnstv",0.0,0);
  1052. X    else
  1053. X       fprintf(stderr,"Invalid axis argument in plenv.\n");
  1054. X}
  1055. END_OF_FILE
  1056. if test 3019 -ne `wc -c <'src/plenv.c'`; then
  1057.     echo shar: \"'src/plenv.c'\" unpacked with wrong size!
  1058. fi
  1059. # end of 'src/plenv.c'
  1060. fi
  1061. if test -f 'src/plfontld.c' -a "${1}" != "-c" ; then 
  1062.   echo shar: Will not clobber existing file \"'src/plfontld.c'\"
  1063. else
  1064. echo shar: Extracting \"'src/plfontld.c'\" \(2221 characters\)
  1065. sed "s/^X//" >'src/plfontld.c' <<'END_OF_FILE'
  1066. X/* Loads either the standard or extended font */
  1067. X
  1068. X#include "plplot.h"
  1069. X#include <stdio.h>
  1070. X
  1071. Xshort int *fntlkup;
  1072. Xshort int *fntindx;
  1073. Xshort int *fntbffr;
  1074. Xshort int numberfonts, numberchars;
  1075. Xshort int indxleng;
  1076. X
  1077. Xstatic short fontloaded=0;
  1078. X
  1079. Xvoid plfontld(fnt)
  1080. XPLINT fnt;
  1081. X{
  1082. X   static short charset;
  1083. X   short bffrleng;
  1084. X   FILE *fontfile;
  1085. X   FILE *indxfile;
  1086. X   FILE *lkupfile;
  1087. X   PLINT level;
  1088. X
  1089. X   glev(&level);
  1090. X   if (level < 1)  plexit("Please call plstar before calling plfontld.");
  1091. X
  1092. X   if(fontloaded) {
  1093. X      if(charset == fnt) return;
  1094. X      free((VOID *)fntindx);
  1095. X      free((VOID *)fntbffr);
  1096. X      free((VOID *)fntlkup);
  1097. X   }
  1098. X
  1099. X   fontloaded = 1;
  1100. X   charset = fnt;
  1101. X
  1102. X   if(fnt)
  1103. X      fontfile = fopen(XSTRKFONT,"r");
  1104. X   else
  1105. X      fontfile = fopen(SSTRKFONT,"r");
  1106. X   if(!fontfile)
  1107. X      plexit("Error opening font file.\n");
  1108. X   fread((char *)&bffrleng,sizeof(short),1,fontfile);
  1109. X   fntbffr = (short *)malloc(bffrleng*sizeof(short));
  1110. X   if(!fntbffr)
  1111. X      plexit("Out of memory while allocating font buffer.\n");
  1112. X   fread((char *)fntbffr,sizeof(short),bffrleng,fontfile);
  1113. X   fclose(fontfile);
  1114. X
  1115. X   if(fnt)
  1116. X     indxfile = fopen(XFONTINDX,"r");
  1117. X   else
  1118. X     indxfile = fopen(SFONTINDX,"r");
  1119. X   if(!indxfile)
  1120. X      plexit("Error opening font file.\n");
  1121. X   fread((char *)&indxleng,sizeof(short),1,indxfile);
  1122. X   fntindx = (short int *)malloc(indxleng*sizeof(short int));
  1123. X   if(!fntindx)
  1124. X      plexit("Out of memory while allocating font buffer.\n");
  1125. X   fread((char *)fntindx,sizeof(short int),indxleng,indxfile);
  1126. X   fclose(indxfile);
  1127. X
  1128. X   if(fnt)
  1129. X      lkupfile = fopen(XFONTLKUP,"r");
  1130. X   else
  1131. X      lkupfile = fopen(SFONTLKUP,"r");
  1132. X   if(!lkupfile)
  1133. X      plexit("Error opening font file.\n");
  1134. X   fread((char *)&bffrleng,sizeof(short),1,lkupfile);
  1135. X   numberfonts = bffrleng/256;
  1136. X   numberchars = bffrleng & 0xff;
  1137. X   bffrleng = numberfonts*numberchars;
  1138. X   fntlkup = (short int *)malloc(bffrleng*sizeof(short int));
  1139. X   if(!fntlkup)
  1140. X      plexit("Out of memory while allocating font buffer.\n");
  1141. X   fread((char *)fntlkup,sizeof(short int),bffrleng,lkupfile);
  1142. X   fclose(lkupfile);
  1143. X}
  1144. X
  1145. Xvoid plfontrel()
  1146. X{
  1147. X   if(fontloaded) {
  1148. X      free((VOID *)fntindx);
  1149. X      free((VOID *)fntbffr);
  1150. X      free((VOID *)fntlkup);
  1151. X      fontloaded=0;
  1152. X   }
  1153. X}
  1154. X
  1155. END_OF_FILE
  1156. if test 2221 -ne `wc -c <'src/plfontld.c'`; then
  1157.     echo shar: \"'src/plfontld.c'\" unpacked with wrong size!
  1158. fi
  1159. # end of 'src/plfontld.c'
  1160. fi
  1161. if test -f 'src/plgrid3.c' -a "${1}" != "-c" ; then 
  1162.   echo shar: Will not clobber existing file \"'src/plgrid3.c'\"
  1163. else
  1164. echo shar: Extracting \"'src/plgrid3.c'\" \(3106 characters\)
  1165. sed "s/^X//" >'src/plgrid3.c' <<'END_OF_FILE'
  1166. X/* Routine to draw a grid around the back side of the 3d plot */
  1167. X/* wih hidden line removal */
  1168. X
  1169. X#include "plplot.h"
  1170. X#include <math.h>
  1171. X
  1172. Xextern PLINT pl3upv;
  1173. X
  1174. Xvoid plgrid3a(tick)
  1175. XPLFLT tick;
  1176. X{
  1177. X    PLFLT xmin, ymin, zmin, xmax, ymax, zmax, zscale;
  1178. X    PLFLT cxx, cxy, cyx, cyy, cyz;
  1179. X    PLINT u[3], v[3];
  1180. X    PLINT nsub, mode, prec;
  1181. X    PLFLT tp;
  1182. X
  1183. X    gw3wc(&cxx,&cxy,&cyx,&cyy,&cyz);
  1184. X    gdom(&xmin,&xmax,&ymin,&ymax);
  1185. X    grange(&zscale,&zmin,&zmax);
  1186. X
  1187. X    nsub = 0;
  1188. X    pldtik(zmin,zmax,&tick,&nsub,&mode,&prec);
  1189. X    tp = tick * floor(zmin/tick) + tick;
  1190. X
  1191. X    pl3upv = 0;
  1192. X
  1193. X    if (cxx >= 0.0 && cxy <= 0.0)  {
  1194. X        while ( tp <= zmax ) {
  1195. X            u[0] = wcpcx(w3wcx(xmin,ymax,tp));
  1196. X            v[0] = wcpcy(w3wcy(xmin,ymax,tp));
  1197. X            u[1] = wcpcx(w3wcx(xmax,ymax,tp));
  1198. X            v[1] = wcpcy(w3wcy(xmax,ymax,tp));
  1199. X            u[2] = wcpcx(w3wcx(xmax,ymin,tp));
  1200. X            v[2] = wcpcy(w3wcy(xmax,ymin,tp));
  1201. X            plnxtv(u,v,3,0);
  1202. X
  1203. X            tp += tick;
  1204. X        }
  1205. X        u[0] = wcpcx(w3wcx(xmax,ymax,zmin));
  1206. X        v[0] = wcpcy(w3wcy(xmax,ymax,zmin));
  1207. X        u[1] = wcpcx(w3wcx(xmax,ymax,zmax));
  1208. X        v[1] = wcpcy(w3wcy(xmax,ymax,zmax));
  1209. X        plnxtv(u,v,2,0);
  1210. X    }
  1211. X    else if(cxx <= 0.0  && cxy <= 0.0)  {
  1212. X        while ( tp <= zmax ) {
  1213. X            u[0] = wcpcx(w3wcx(xmax,ymax,tp));
  1214. X            v[0] = wcpcy(w3wcy(xmax,ymax,tp));
  1215. X            u[1] = wcpcx(w3wcx(xmax,ymin,tp));
  1216. X            v[1] = wcpcy(w3wcy(xmax,ymin,tp));
  1217. X            u[2] = wcpcx(w3wcx(xmin,ymin,tp));
  1218. X            v[2] = wcpcy(w3wcy(xmin,ymin,tp));
  1219. X            plnxtv(u,v,3,0);
  1220. X
  1221. X            tp += tick;
  1222. X        }
  1223. X        u[0] = wcpcx(w3wcx(xmax,ymin,zmin));
  1224. X        v[0] = wcpcy(w3wcy(xmax,ymin,zmin));
  1225. X        u[1] = wcpcx(w3wcx(xmax,ymin,zmax));
  1226. X        v[1] = wcpcy(w3wcy(xmax,ymin,zmax));
  1227. X        plnxtv(u,v,2,0);
  1228. X    }
  1229. X    else if(cxx <= 0.0  && cxy >= 0.0)  {
  1230. X        while ( tp <= zmax ) {
  1231. X            u[0] = wcpcx(w3wcx(xmax,ymin,tp));
  1232. X            v[0] = wcpcy(w3wcy(xmax,ymin,tp));
  1233. X            u[1] = wcpcx(w3wcx(xmin,ymin,tp));
  1234. X            v[1] = wcpcy(w3wcy(xmin,ymin,tp));
  1235. X            u[2] = wcpcx(w3wcx(xmin,ymax,tp));
  1236. X            v[2] = wcpcy(w3wcy(xmin,ymax,tp));
  1237. X            plnxtv(u,v,3,0);
  1238. X
  1239. X            tp += tick;
  1240. X        }
  1241. X        u[0] = wcpcx(w3wcx(xmin,ymin,zmin));
  1242. X        v[0] = wcpcy(w3wcy(xmin,ymin,zmin));
  1243. X        u[1] = wcpcx(w3wcx(xmin,ymin,zmax));
  1244. X        v[1] = wcpcy(w3wcy(xmin,ymin,zmax));
  1245. X        plnxtv(u,v,2,0);
  1246. X    }
  1247. X    else if(cxx >= 0.0  && cxy >= 0.0)  {
  1248. X        while ( tp <= zmax ) {
  1249. X            u[0] = wcpcx(w3wcx(xmin,ymin,tp));
  1250. X            v[0] = wcpcy(w3wcy(xmin,ymin,tp));
  1251. X            u[1] = wcpcx(w3wcx(xmin,ymax,tp));
  1252. X            v[1] = wcpcy(w3wcy(xmin,ymax,tp));
  1253. X            u[2] = wcpcx(w3wcx(xmax,ymax,tp));
  1254. X            v[2] = wcpcy(w3wcy(xmax,ymax,tp));
  1255. X            plnxtv(u,v,3,0);
  1256. X
  1257. X            tp += tick;
  1258. X        }
  1259. X        u[0] = wcpcx(w3wcx(xmin,ymax,zmin));
  1260. X        v[0] = wcpcy(w3wcy(xmin,ymax,zmin));
  1261. X        u[1] = wcpcx(w3wcx(xmin,ymax,zmax));
  1262. X        v[1] = wcpcy(w3wcy(xmin,ymax,zmax));
  1263. X        plnxtv(u,v,2,0);
  1264. X    }
  1265. X
  1266. X    pl3upv = 1;
  1267. X}
  1268. X
  1269. END_OF_FILE
  1270. if test 3106 -ne `wc -c <'src/plgrid3.c'`; then
  1271.     echo shar: \"'src/plgrid3.c'\" unpacked with wrong size!
  1272. fi
  1273. # end of 'src/plgrid3.c'
  1274. fi
  1275. if test -f 'src/plt3zz.c' -a "${1}" != "-c" ; then 
  1276.   echo shar: Will not clobber existing file \"'src/plt3zz.c'\"
  1277. else
  1278. echo shar: Extracting \"'src/plt3zz.c'\" \(2154 characters\)
  1279. sed "s/^X//" >'src/plt3zz.c' <<'END_OF_FILE'
  1280. X/* Draws the next zig-zag line for a 3-d plot. The data is stored in */
  1281. X/* array z(*,ly) as a function of x() and y(). The subarray */
  1282. X/* z(1:nx,1:ny) is plotted out, starting at index (xstar0,ystar0). */
  1283. X/* Depending on the state of "flg0", the sequence of data points */
  1284. X/* sent to plnxtv is altered so as to allow cross-hatch plotting, */
  1285. X/* or plotting parallel to either the x-axis or the y-axis. */
  1286. X
  1287. X#include "plplot.h"
  1288. X
  1289. Xvoid plt3zz(xstar0,ystar0,dx,dy,flg0,init,x,y,z,ly,nx,ny,u,v)
  1290. XPLINT xstar0, ystar0, dx, dy, flg0, ly, nx, ny, init;
  1291. XPLFLT *x, *y, *z;
  1292. XPLINT *u, *v;
  1293. X{
  1294. X      PLINT flag;
  1295. X      PLINT n;
  1296. X      PLINT xstart, ystart;
  1297. X
  1298. X      n = 0;
  1299. X      xstart = xstar0;
  1300. X      ystart = ystar0;
  1301. X      flag = flg0;
  1302. X
  1303. Xlab1:
  1304. X      if (1 <= xstart && xstart <= nx && 1 <= ystart && ystart <= ny) {
  1305. X        u[n] = wcpcx(w3wcx(x[xstart-1],y[ystart-1],
  1306. X                      *(z+(xstart-1)*ly+(ystart-1))));
  1307. X        v[n] = wcpcy(w3wcy(x[xstart-1],y[ystart-1],
  1308. X                      *(z+(xstart-1)*ly+(ystart-1))));
  1309. X        if (flag == -3) {
  1310. X          ystart = ystart + dy;
  1311. X          flag = -flag;
  1312. X        }
  1313. X        else if (flag == -2)
  1314. X          ystart = ystart + dy;
  1315. X        else if (flag == -1) {
  1316. X          ystart = ystart + dy;
  1317. X          flag = 1;
  1318. X        }
  1319. X        else if (flag == 1)
  1320. X          xstart = xstart + dx;
  1321. X        else if (flag == 2)  {
  1322. X          xstart = xstart + dx;
  1323. X          flag = -2;
  1324. X        }
  1325. X        else if (flag == 3) {
  1326. X          xstart = xstart + dx;
  1327. X          flag = -flag;
  1328. X        }
  1329. X        n = n+1;
  1330. X        goto lab1;
  1331. X      }
  1332. X
  1333. X      if (flag == 1 || flag == -2) {
  1334. X        if (flag == 1) {
  1335. X          xstart = xstart - dx;
  1336. X          ystart = ystart + dy;
  1337. X        }
  1338. X        else if (flag == -2) {
  1339. X          ystart = ystart - dy;
  1340. X          xstart = xstart + dx;
  1341. X        }
  1342. X
  1343. X        if (1 <= xstart && xstart <= nx  && 1 <= ystart && ystart <= ny) {
  1344. X          u[n] = wcpcx(w3wcx(x[xstart-1],y[ystart-1],
  1345. X                       *(z+(xstart-1)*ly+(ystart-1))));
  1346. X          v[n] = wcpcy(w3wcy(x[xstart-1],y[ystart-1],
  1347. X                       *(z+(xstart-1)*ly+(ystart-1))));
  1348. X          n = n+1;
  1349. X        }
  1350. X
  1351. X      }
  1352. X      plnxtv(u,v,n,init);
  1353. X}
  1354. END_OF_FILE
  1355. if test 2154 -ne `wc -c <'src/plt3zz.c'`; then
  1356.     echo shar: \"'src/plt3zz.c'\" unpacked with wrong size!
  1357. fi
  1358. # end of 'src/plt3zz.c'
  1359. fi
  1360. if test -f 'src/plw3d.c' -a "${1}" != "-c" ; then 
  1361.   echo shar: Will not clobber existing file \"'src/plw3d.c'\"
  1362. else
  1363. echo shar: Extracting \"'src/plw3d.c'\" \(2197 characters\)
  1364. sed "s/^X//" >'src/plw3d.c' <<'END_OF_FILE'
  1365. X/* Set up a window for three-dimensional plotting. The data are mapped */
  1366. X/* into a box with world coordinate size "basex" by "basey" by "height", */
  1367. X/* with the base being symmetrically positioned about zero. Thus */
  1368. X/* the mapping between data 3-d and world 3-d coordinates is given by: */
  1369. X
  1370. X/*   x = xmin   =>   wx = -0.5*basex */
  1371. X/*   x = xmax   =>   wx =  0.5*basex */
  1372. X/*   y = ymin   =>   wy = -0.5*basey */
  1373. X/*   y = ymax   =>   wy =  0.5*basey */
  1374. X/*   z = zmin   =>   wz =  0.0 */
  1375. X/*   z = zmax   =>   wz =  height */
  1376. X
  1377. X/* The world coordinate box is then viewed from position "alt"-"az", */
  1378. X/* measured in degrees. For proper operation, 0 <= alt <= 90 degrees, */
  1379. X/* but az can be any value. */
  1380. X
  1381. X#include "plplot.h"
  1382. X#include <math.h>
  1383. X
  1384. X#define  dtr   0.01745329252
  1385. X
  1386. Xvoid plw3d(basex,basey,height,xmin0,xmax0,ymin0,ymax0,zmin0,zmax0,alt,az)
  1387. XPLFLT basex, basey, height, xmin0, xmax0, ymin0, ymax0, zmin0, zmax0;
  1388. XPLFLT alt, az;
  1389. X{
  1390. X      PLFLT xmin, xmax, ymin, ymax, zmin, zmax, d;
  1391. X      PLFLT cx, cy, saz, caz, salt, calt, zscale;
  1392. X      PLINT level;
  1393. X
  1394. X      glev(&level);
  1395. X      if (level < 3) plexit("Please set up 2-d window before calling plw3d.");
  1396. X      if (basex <= 0.0 || basey <= 0.0 || height <= 0.0)
  1397. X              plexit("Invalid world coordinate boxsize in plw3d.");
  1398. X      if (xmin0 == xmax0 || ymin0 == ymax0 || zmin0 == zmax0)
  1399. X              plexit("Invalid axis range in plw3d.");
  1400. X      if (alt<0.0 || alt>90.0)
  1401. X              plexit("Altitude must be between 0 and 90 degrees in plw3d.");
  1402. X
  1403. X      d = 1.0e-5*(xmax0-xmin0);
  1404. X      xmax = xmax0 + d;
  1405. X      xmin = xmin0 - d;
  1406. X      d = 1.0e-5*(ymax0-ymin0);
  1407. X      ymax = ymax0 + d;
  1408. X      ymin = ymin0 - d;
  1409. X      d = 1.0e-5*(zmax0-zmin0);
  1410. X      zmax = zmax0 + d;
  1411. X      zmin = zmin0 - d;
  1412. X      cx = basex/(xmax-xmin);
  1413. X      cy = basey/(ymax-ymin);
  1414. X      zscale = height/(zmax-zmin);
  1415. X      saz = sin(dtr*az);
  1416. X      caz = cos(dtr*az);
  1417. X      salt = sin(dtr*alt);
  1418. X      calt = cos(dtr*alt);
  1419. X
  1420. X      sdom(xmin,xmax,ymin,ymax);
  1421. X      srange(zscale,zmin,zmax);
  1422. X      sbase(basex,basey,(PLFLT)(0.5*(xmin+xmax)),(PLFLT)(0.5*(ymin+ymax)));
  1423. X
  1424. X      sw3wc((PLFLT)(cx*caz),(PLFLT)(-cy*saz),(PLFLT)(cx*saz*salt),(PLFLT)(cy*caz*salt),(PLFLT)(zscale*calt));
  1425. X}
  1426. X
  1427. END_OF_FILE
  1428. if test 2197 -ne `wc -c <'src/plw3d.c'`; then
  1429.     echo shar: \"'src/plw3d.c'\" unpacked with wrong size!
  1430. fi
  1431. # end of 'src/plw3d.c'
  1432. fi
  1433. if test -f 'unix/Makefile' -a "${1}" != "-c" ; then 
  1434.   echo shar: Will not clobber existing file \"'unix/Makefile'\"
  1435. else
  1436. echo shar: Extracting \"'unix/Makefile'\" \(2767 characters\)
  1437. sed "s/^X//" >'unix/Makefile' <<'END_OF_FILE'
  1438. XSRCS  =   ../src/define.c \
  1439. X          ../src/fcnvrt.c \
  1440. X          ../src/genlin.c \
  1441. X          ../src/global.c \
  1442. X          ../src/icnvrt.c \
  1443. X          ../src/movphy.c \
  1444. X          ../src/movwor.c \
  1445. X          ../src/pl3cut.c \
  1446. X          ../src/plabv.c \
  1447. X          ../src/pladv.c \
  1448. X          ../src/plbeg.c \
  1449. X          ../src/plbin.c \
  1450. X          ../src/plbox.c \
  1451. X          ../src/plbox3.c \
  1452. X          ../src/plccal.c \
  1453. X          ../src/plclr.c \
  1454. X          ../src/plcntr.c \
  1455. X          ../src/plcol.c \
  1456. X          ../src/plcont.c \
  1457. X          ../src/plcvec.c \
  1458. X          ../src/pldeco.c \
  1459. X          ../src/pldtik.c \
  1460. X          ../src/plend.c \
  1461. X          ../src/plenv.c \
  1462. X          ../src/plerrx.c \
  1463. X          ../src/plerry.c \
  1464. X          ../src/plerx1.c \
  1465. X          ../src/plery1.c \
  1466. X          ../src/plexit.c \
  1467. X          ../src/plfill.c \
  1468. X          ../src/plfont.c \
  1469. X          ../src/plfontld.c \
  1470. X          ../src/plform.c \
  1471. X          ../src/plgra.c \
  1472. X          ../src/plgrid3.c \
  1473. X          ../src/plgspa.c \
  1474. X          ../src/plhist.c \
  1475. X          ../src/plhrsh.c \
  1476. X          ../src/pljoin.c \
  1477. X          ../src/pllab.c \
  1478. X          ../src/pllclp.c \
  1479. X          ../src/plline.c \
  1480. X          ../src/pllsty.c \
  1481. X          ../src/plmesh.c \
  1482. X          ../src/plmtex.c \
  1483. X          ../src/plnxtv.c \
  1484. X          ../src/plot3d.c \
  1485. X          ../src/plpage.c \
  1486. X          ../src/plpat.c \
  1487. X          ../src/plpoi1.c \
  1488. X          ../src/plpoin.c \
  1489. X          ../src/plpsty.c \
  1490. X          ../src/plptex.c \
  1491. X          ../src/plr135.c \
  1492. X          ../src/plr45.c \
  1493. X          ../src/plschr.c \
  1494. X          ../src/plside3.c \
  1495. X          ../src/plsmaj.c \
  1496. X          ../src/plsmin.c \
  1497. X          ../src/plssym.c \
  1498. X          ../src/plstar.c \
  1499. X          ../src/plstik.c \
  1500. X          ../src/plstr.c \
  1501. X          ../src/plstrl.c \
  1502. X          ../src/plstyl.c \
  1503. X          ../src/plsvpa.c \
  1504. X          ../src/plsym.c \
  1505. X          ../src/plsym1.c \
  1506. X          ../src/plt3zz.c \
  1507. X          ../src/pltext.c \
  1508. X          ../src/plvpor.c \
  1509. X          ../src/plvsta.c \
  1510. X          ../src/plw3d.c \
  1511. X          ../src/plwid.c \
  1512. X          ../src/plwind.c \
  1513. X          ../src/plxtik.c \
  1514. X          ../src/plxybx.c \
  1515. X          ../src/plxytx.c \
  1516. X          ../src/plytik.c \
  1517. X          ../src/plzbx.c \
  1518. X          ../src/plztx.c \
  1519. X          ../src/setphy.c \
  1520. X          ../src/setpxl.c \
  1521. X          ../src/setsub.c \
  1522. X          ../src/stindex.c \
  1523. X          ../src/strpos.c \
  1524. X          ../src/stsearch.c \
  1525. X          ../src/xform.c
  1526. X
  1527. XDRVS  =   xterm.c \
  1528. X          tektronix.c \
  1529. X          dg300.c \
  1530. X          hp7470.c \
  1531. X          hp7580.c \
  1532. X          impress.c \
  1533. X          laserjetii.c \
  1534. X          postscript.c \
  1535. X          dispatch.c
  1536. X
  1537. X/home/dukee2/amr/lib/libplplots.a: $(SRCS) $(DRVS)
  1538. X    cc -c -I../include $?
  1539. X    ar -r $@ $(?F:.c=.o)
  1540. X    /bin/rm $(?F:.c=.o)
  1541. END_OF_FILE
  1542. if test 2767 -ne `wc -c <'unix/Makefile'`; then
  1543.     echo shar: \"'unix/Makefile'\" unpacked with wrong size!
  1544. fi
  1545. # end of 'unix/Makefile'
  1546. fi
  1547. if test -f 'unix/hp7470.c' -a "${1}" != "-c" ; then 
  1548.   echo shar: Will not clobber existing file \"'unix/hp7470.c'\"
  1549. else
  1550. echo shar: Extracting \"'unix/hp7470.c'\" \(3143 characters\)
  1551. sed "s/^X//" >'unix/hp7470.c' <<'END_OF_FILE'
  1552. X/* This file contains the IMPRESS device dependent subroutines for */
  1553. X/* use with plplot. */
  1554. X
  1555. X#include "plplot.h"
  1556. X#include <stdio.h>
  1557. X
  1558. X#define ESC          27
  1559. X#define HP7470X   10299
  1560. X#define HP7470Y    7649
  1561. X
  1562. Xstatic FILE *OutFile;
  1563. Xstatic int porient;
  1564. Xstatic int select=0;
  1565. Xstatic char FileName[80];
  1566. Xstatic int curpen, curwid;
  1567. X
  1568. Xvoid hp7470setup(xdpi,ydpi,xwid,ywid)
  1569. XPLINT xwid, ywid;
  1570. XPLFLT xdpi, ydpi;
  1571. X{
  1572. X}
  1573. X
  1574. X/* Open file.  Set up for graphics. */
  1575. Xvoid hp7470init()
  1576. X{
  1577. X      char response[80];
  1578. X      int ori;
  1579. X
  1580. X      smod(0);  /* not an interactive terminal */
  1581. X      scol(1);
  1582. X      swid(1);
  1583. X      setpxl(40.,40.);
  1584. X      
  1585. X      if(!select) {
  1586. X         printf("Landscape or portrait orientation? (0 or 1): ");
  1587. X         fgets(response,sizeof(response),stdin);
  1588. X         if(sscanf(response,"%d",&ori) != 1)
  1589. X            ori = 0;   /* carriage return defaults to landscape */
  1590. X      }
  1591. X      
  1592. X      porient = ori;
  1593. X      if(!porient)
  1594. X         setphy(0,HP7470X,0,HP7470Y);
  1595. X      else
  1596. X         setphy(0,HP7470Y,0,HP7470X);
  1597. X
  1598. X      OutFile = NULL;
  1599. X      while(!OutFile) {
  1600. X         if(!select) {
  1601. X            printf("Enter graphics command storage file name. ");
  1602. X            fgets(response,sizeof(response),stdin);
  1603. X            if(sscanf(response,"%s",FileName) != 1) {
  1604. X                printf("Invalid entry.n");
  1605. X                continue;
  1606. X            }
  1607. X         }
  1608. X         if ((OutFile = fopen(FileName,"w")) == NULL) 
  1609. X             printf("Can't open %s.\n",FileName);
  1610. X         select=0;
  1611. X      }
  1612. X      fprintf(OutFile,"%c.I200;;17:%c.N;19:%c.M;;;10:in;\n",ESC,ESC,ESC);
  1613. X}
  1614. X
  1615. Xvoid hp7470select(ori,file)
  1616. XPLINT ori;
  1617. Xchar *file;
  1618. X{
  1619. X   porient = ori;
  1620. X   strncpy(FileName,file,79);
  1621. X   FileName[79]='\0';
  1622. X   select = 1;
  1623. X}
  1624. X
  1625. X/* Sets the IMPRESS to text mode */
  1626. Xvoid hp7470text()
  1627. X{
  1628. X}
  1629. X
  1630. X/* Sets the IMPRESS to graphics mode */
  1631. Xvoid hp7470graph()
  1632. X{
  1633. X}
  1634. X
  1635. X/* Form feed */
  1636. Xvoid hp7470clear()
  1637. X{
  1638. X}
  1639. X
  1640. Xstatic PLINT xold, yold;
  1641. X
  1642. Xvoid hp7470page()
  1643. X{
  1644. X   fprintf(OutFile,"pg;\n");
  1645. X   xold = -100000;
  1646. X   yold = -100000;
  1647. X}
  1648. X
  1649. Xvoid hp7470color(colour)
  1650. XPLINT colour;
  1651. X{
  1652. X  if(colour<1 || colour>8)
  1653. X    fprintf(stderr,"\nInvalid pen selection.");
  1654. X  else {
  1655. X    fprintf(OutFile,"sp%d %d\n",colour,curwid);
  1656. X    curpen = colour;
  1657. X  }
  1658. X}
  1659. X
  1660. Xvoid hp7470width(width)
  1661. XPLINT width;
  1662. X{
  1663. X  if(width<1 || width>48)
  1664. X    fprintf(stderr,"\nInvalid pen width selection.");
  1665. X  else {
  1666. X    fprintf(OutFile,"sp%d %d\n",curpen,width);
  1667. X    curwid = width;
  1668. X  }
  1669. X}
  1670. X
  1671. Xvoid hp7470line(x1,y1,x2,y2)
  1672. XPLINT x1,y1,x2,y2;
  1673. X{
  1674. X
  1675. X      if(!porient) {
  1676. X         if(x1 == xold && y1 == yold) 
  1677. X           /* Add new point to path */
  1678. X           fprintf(OutFile,"pd%d %d\n",x2,y2);
  1679. X         else 
  1680. X           /* Write out old path */
  1681. X           fprintf(OutFile,"pu%d %d pd%d %d\n",x1,y1,x2,y2);
  1682. X      }
  1683. X      else {
  1684. X         if(x1 == xold && y1 == yold) 
  1685. X           /* Add new point to path */
  1686. X           fprintf(OutFile,"pd%d %d\n",HP7470X-y2,x2);
  1687. X         else 
  1688. X           /* Write out old path */
  1689. X           fprintf(OutFile,"pu%d %d pd%d %d\n",HP7470X-y1,x1,HP7470X-y2,x2);
  1690. X      }
  1691. X        
  1692. X      xold = x2;
  1693. X      yold = y2;
  1694. X}
  1695. X      
  1696. X/* Close graphics file */
  1697. Xvoid hp7470tidy()
  1698. X{
  1699. X      fprintf(OutFile,"sp0\n");
  1700. X      fclose(OutFile);
  1701. X      select = 0;
  1702. X}
  1703. X
  1704. END_OF_FILE
  1705. if test 3143 -ne `wc -c <'unix/hp7470.c'`; then
  1706.     echo shar: \"'unix/hp7470.c'\" unpacked with wrong size!
  1707. fi
  1708. # end of 'unix/hp7470.c'
  1709. fi
  1710. if test -f 'unix/hp7580.c' -a "${1}" != "-c" ; then 
  1711.   echo shar: Will not clobber existing file \"'unix/hp7580.c'\"
  1712. else
  1713. echo shar: Extracting \"'unix/hp7580.c'\" \(3003 characters\)
  1714. sed "s/^X//" >'unix/hp7580.c' <<'END_OF_FILE'
  1715. X/* This file contains the IMPRESS device dependent subroutines for */
  1716. X/* use with plplot. */
  1717. X
  1718. X#include "plplot.h"
  1719. X#include <stdio.h>
  1720. X
  1721. X#define HPXMIN  -4500
  1722. X#define HPXMAX   4500
  1723. X#define HPYMIN  -2790
  1724. X#define HPYMAX   2790
  1725. X#define ESC    27
  1726. X
  1727. Xstatic FILE *OutFile;
  1728. Xstatic int  porient;
  1729. Xstatic int select=0;
  1730. Xchar FileName[80];
  1731. X
  1732. Xvoid hp7580setup(xdpi,ydpi,xwid,ywid)
  1733. XPLINT xwid, ywid;
  1734. XPLFLT xdpi, ydpi;
  1735. X{
  1736. X}
  1737. X
  1738. X/* Open file.  Set up for graphics. */
  1739. Xvoid hp7580init()
  1740. X{
  1741. X      char response[80];
  1742. X      int ori;
  1743. X
  1744. X      smod(0);  /* not an interactive terminal */
  1745. X      scol(1);
  1746. X      swid(1);
  1747. X      setpxl(40.,40.);
  1748. X      
  1749. X      if(!select) {
  1750. X         printf("Landscape or portrait orientation? (0 or 1): ");
  1751. X         fgets(response,sizeof(response),stdin);
  1752. X         if(sscanf(response,"%d",&ori) != 1)
  1753. X            ori = 0;   /* carriage return defaults to landscape */
  1754. X      }
  1755. X      
  1756. X      porient = ori;
  1757. X      if(!porient)
  1758. X         setphy(HPXMIN,HPXMAX,HPYMIN,HPYMAX);
  1759. X      else
  1760. X         setphy(HPYMIN,HPYMAX,HPXMIN,HPXMAX);
  1761. X
  1762. X      OutFile = NULL;
  1763. X      while(!OutFile) {
  1764. X         if(!select) {
  1765. X            printf("Enter graphics command storage file name. ");
  1766. X            fgets(response,sizeof(response),stdin);
  1767. X            if(sscanf(response,"%s",FileName) != 1) {
  1768. X                printf("Invalid entry.n");
  1769. X                continue;
  1770. X            }
  1771. X         }
  1772. X         if ((OutFile = fopen(FileName,"w")) == NULL) 
  1773. X             printf("Can't open %s.\n",FileName);
  1774. X         select = 0;
  1775. X      }
  1776. X      fprintf(OutFile,"%c.I200;;17:%c.N;19:%c.M;;;10:in;\n",ESC,ESC,ESC);
  1777. X      fprintf(OutFile,"ro 90;ip;sp 4;pa;");
  1778. X}
  1779. X
  1780. Xvoid hp7580select(ori,file)
  1781. XPLINT ori;
  1782. Xchar *file;
  1783. X{
  1784. X   porient = ori;
  1785. X   strncpy(FileName,file,sizeof(FileName)-1);
  1786. X   FileName[sizeof(FileName)-1] = '\0';
  1787. X   select = 1;
  1788. X}
  1789. X
  1790. X/* Sets to text mode */
  1791. Xvoid hp7580text()
  1792. X{
  1793. X}
  1794. X
  1795. X/* Sets the IMPRESS to graphics mode */
  1796. Xvoid hp7580graph()
  1797. X{
  1798. X}
  1799. X
  1800. X/* Form feed */
  1801. Xvoid hp7580clear()
  1802. X{
  1803. X}
  1804. X
  1805. Xstatic int xold, yold;
  1806. X
  1807. Xvoid hp7580page()
  1808. X{
  1809. X   xold=-100000; yold=-100000;
  1810. X}
  1811. X
  1812. X/* May put something here someday */
  1813. Xvoid hp7580color(colour)
  1814. XPLINT colour;
  1815. X{
  1816. X  if(colour<1 || colour>8)
  1817. X    fprintf(stderr,"\nInvalid pen selection.");
  1818. X  else
  1819. X    fprintf(OutFile,"sp%d\n",colour);
  1820. X}
  1821. X
  1822. Xvoid hp7580width(width)
  1823. XPLINT width;
  1824. X{
  1825. X}
  1826. X
  1827. Xvoid hp7580line(x1,y1,x2,y2)
  1828. XPLINT x1,y1,x2,y2;
  1829. X{
  1830. X
  1831. X      if(!porient) {
  1832. X         if(x1 == xold && y1 == yold) 
  1833. X           /* Add new point to path */
  1834. X           fprintf(OutFile," %d %d",x2,y2);
  1835. X         else 
  1836. X           /* Write out old path */
  1837. X           fprintf(OutFile,"\npu%d %d pd%d %d",x1,y1,x2,y2);
  1838. X      }
  1839. X      else {
  1840. X         if(x1 == xold && y1 == yold) 
  1841. X           /* Add new point to path */
  1842. X           fprintf(OutFile," %d %d",-y2,x2);
  1843. X         else 
  1844. X           /* Write out old path */
  1845. X           fprintf(OutFile,"\npu%d %d pd%d %d",-y1,x1,-y2,x2);
  1846. X      }
  1847. X        
  1848. X      xold = x2;
  1849. X      yold = y2;
  1850. X}
  1851. X      
  1852. X/* Close graphics file */
  1853. Xvoid hp7580tidy()
  1854. X{
  1855. X      fprintf(OutFile,"\nsp0");
  1856. X      fclose(OutFile);
  1857. X      select = 0;
  1858. X}
  1859. X
  1860. END_OF_FILE
  1861. if test 3003 -ne `wc -c <'unix/hp7580.c'`; then
  1862.     echo shar: \"'unix/hp7580.c'\" unpacked with wrong size!
  1863. fi
  1864. # end of 'unix/hp7580.c'
  1865. fi
  1866. if test -f 'unix/xterm.c' -a "${1}" != "-c" ; then 
  1867.   echo shar: Will not clobber existing file \"'unix/xterm.c'\"
  1868. else
  1869. echo shar: Extracting \"'unix/xterm.c'\" \(2806 characters\)
  1870. sed "s/^X//" >'unix/xterm.c' <<'END_OF_FILE'
  1871. X#include "plplot.h"
  1872. X#include <stdio.h>
  1873. X
  1874. X/* This file contains the xterm dependent routines for use with plplot. */
  1875. X
  1876. X#define TEKX   1023
  1877. X#define TEKY    779
  1878. X
  1879. X/* Define graphics control characters. */
  1880. X#define FF   12
  1881. X#define CAN  24
  1882. X#define ESC  27
  1883. X#define GS   29
  1884. X#define US   31
  1885. X#define ETX  003
  1886. X
  1887. Xvoid xtesetup(xdpi, ydpi, xwid, ywid)
  1888. XPLINT xwid, ywid;
  1889. XPLFLT xdpi, ydpi;
  1890. X{
  1891. X   /* the user doesn't know what he's talking about. ignore this stuff */
  1892. X}
  1893. X
  1894. Xvoid xteselect(ori, name)
  1895. XPLINT ori;
  1896. Xchar *name;
  1897. X{
  1898. X}
  1899. X
  1900. Xvoid xteinit()
  1901. X{
  1902. X      /* tell plplot that this is an interactive device (so pause after */
  1903. X      /* drawing graph).  use if smod(0) if sending grphx to a file. */
  1904. X      smod(1);   /* interactive device */
  1905. X
  1906. X      /* set default pen color (this should be the desired pen number) */
  1907. X      /* plplot will actually tell the device to use this pen by */
  1908. X      /* making a call to plcolor. */
  1909. X      scol(1);
  1910. X
  1911. X      swid(1);
  1912. X      /* set device resolution in dots/mm */
  1913. X      setpxl(4.771*16,4.653*16);
  1914. X
  1915. X      /* set page size using setphy(xmin,xmax,ymin,ymax) */
  1916. X      /* plplot assumes that the min coordinates are in the lower left */
  1917. X      setphy(0,16*TEKX,0,16*TEKY);
  1918. X
  1919. X      printf("%c[?38h",ESC); /* open graphics window */
  1920. X      printf("%c",GS);       /* set to vector mode */
  1921. X      printf("%c%c",ESC,FF);
  1922. X}
  1923. X
  1924. X/* Sets to text mode */
  1925. Xvoid xtetext()
  1926. X{
  1927. X    printf("%c",US);
  1928. X}
  1929. X
  1930. X/* Sets to graphics mode */
  1931. Xvoid xtegraph()
  1932. X{
  1933. X    /* Nothing has to be done here */
  1934. X}
  1935. X
  1936. X/* Clears the screen */
  1937. Xvoid xteclear()
  1938. X{
  1939. X     putchar('\007');
  1940. X     fflush(stdout);
  1941. X     while(getchar() != '\n')
  1942. X        ;
  1943. X     printf("%c%c",ESC,FF);
  1944. X}
  1945. X
  1946. Xstatic PLINT xold, yold;
  1947. X
  1948. Xvoid xtepage()
  1949. X{
  1950. X   xold = -100000;
  1951. X   yold = -100000;
  1952. X}
  1953. X
  1954. X/* Change color */
  1955. Xvoid xtecolor(colour)
  1956. XPLINT colour;
  1957. X{
  1958. X}
  1959. X
  1960. Xvoid xtewidth(width)
  1961. XPLINT width;
  1962. X{
  1963. X}
  1964. X
  1965. X/* Draws a line in the current colour from (x1,y1) to (x2,y2) */
  1966. Xvoid xteline(x1,y1,x2,y2)
  1967. XPLINT x1,y1,x2,y2;
  1968. X{
  1969. X    PLINT hy,ly,hx,lx;
  1970. X
  1971. X    x1 >>= 4;
  1972. X    y1 >>= 4;
  1973. X    x2 >>= 4;
  1974. X    y2 >>= 4;
  1975. X    /* If continuation of previous line just send new point */
  1976. X    if(x1 == xold && y1 == yold) {
  1977. X       hy = y2/32 + 32;
  1978. X       ly = y2 - (y2/32)*32 + 96;
  1979. X       hx = x2/32 + 32;
  1980. X       lx = x2 - (x2/32)*32 + 64;
  1981. X       printf("%c%c%c%c",hy,ly,hx,lx);
  1982. X    }
  1983. X    else {
  1984. X       printf("%c",GS);
  1985. X       hy = y1/32 + 32;
  1986. X       ly = y1 - (y1/32)*32 + 96;
  1987. X       hx = x1/32 + 32;
  1988. X       lx = x1 - (x1/32)*32 + 64;
  1989. X       printf("%c%c%c%c",hy,ly,hx,lx);
  1990. X       hy = y2/32 + 32;
  1991. X       ly = y2 - (y2/32)*32 + 96;
  1992. X       hx = x2/32 + 32;
  1993. X       lx = x2 - (x2/32)*32 + 64;
  1994. X       printf("%c%c%c%c",hy,ly,hx,lx);
  1995. X    }
  1996. X    xold = x2;
  1997. X    yold = y2;
  1998. X}
  1999. X
  2000. Xvoid xtetidy()
  2001. X{
  2002. X   putchar('\007');
  2003. X   fflush(stdout);
  2004. X   while(getchar() != '\n')
  2005. X      ;
  2006. X   printf("%c%c",US,CAN);
  2007. X   printf("%c%c",ESC,ETX);
  2008. X   fflush(stdout);
  2009. X}
  2010. X
  2011. END_OF_FILE
  2012. if test 2806 -ne `wc -c <'unix/xterm.c'`; then
  2013.     echo shar: \"'unix/xterm.c'\" unpacked with wrong size!
  2014. fi
  2015. # end of 'unix/xterm.c'
  2016. fi
  2017. echo shar: End of archive 3 \(of 12\).
  2018. cp /dev/null ark3isdone
  2019. MISSING=""
  2020. for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
  2021.     if test ! -f ark${I}isdone ; then
  2022.     MISSING="${MISSING} ${I}"
  2023.     fi
  2024. done
  2025. if test "${MISSING}" = "" ; then
  2026.     echo You have unpacked all 12 archives.
  2027.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2028. else
  2029.     echo You still need to unpack the following archives:
  2030.     echo "        " ${MISSING}
  2031. fi
  2032. ##  End of shell archive.
  2033. exit 0
  2034. -- 
  2035. Submissions to comp.sources.amiga and comp.binaries.amiga should be sent to:
  2036.     amiga@cs.odu.edu    
  2037. or    amiga@xanth.cs.odu.edu    ( obsolescent mailers may need this address )
  2038. or    ...!uunet!xanth!amiga    ( very obsolescent mailers need this address )
  2039.  
  2040. Comments, questions, and suggestions s should be addressed to ``amiga-request''
  2041. (only use ``amiga'' for submissions) at the above addresses.
  2042.